package com.deep.test.thread.concurrent;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;

/**
 * <p>Description:</p>
 * Created with IDEA
 * 查看一个普通的java类有哪些线程
 * author:hudepin
 * createTime:2018/7/5 14:42
 */
public class MultiThread {
    public static void main(String[] args) {
        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
        ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(false,false);
        for(ThreadInfo t:threadInfos){
            System.out.println("["+t.getThreadId()+"],["+t.getThreadName()+"]");
        }
        /**
         * [6],[Monitor Ctrl-Break] 监控Ctrl-Break中断信号
         [5],[Attach Listener] 监听事件的线程
         [4],[Signal Dispatcher] 分发处理发送给JVM信号的线程
         [3],[Finalizer] 调用对象finalize方法的线程
         [2],[Reference Handler]  清除Reference的线程
         [1],[main] 主线程
         */
    }
}
